/**
 * <p>fieldset控件</p>
 * defaults: {
		xtype: 'cceaftextfield',
	    labelAlign: 'right',
	    labelWidth: 70
   }
 * 继承自Ext.form.FieldSet，xtype = cceaffieldset

 * @module Ext-ux-cceaf-control
 * @class cceaf.control.FieldSet
 * @extends Ext.form.FieldSet
 * @since 1.0
 */
Ext.define('cceaf.control.FieldSet',{
	extend: 'Ext.form.FieldSet', 
	requires: [
   	    'cceaf.ControlDefaultConfig'
    ],
    alias: 'widget.cceaffieldset',
    
    constructor: function(config){
		config = config || {};
		
		var defaultLabelWidth = cceaf.ControlDefaultConfig.DEFAULT_LABEL_WIDTH;
		config = Ext.applyIf(config || {}, {
			//bodyStyle:'padding:10px 10px 20px 0px',
			defaults: {
				xtype: 'cceaftextfield',
			    labelAlign: 'right',
			    allowBlank: true,
			    labelWidth: defaultLabelWidth
		    }
		});

		cceaf.control.FieldSet.superclass.constructor.apply(this, arguments);
	},
	
	initComponent : function(){
		var noAllowBlankFieldLabelStyle = cceaf.ControlDefaultConfig.NO_ALLOW_BLANK_FIELD_LABEL_STYLE;
		
		var items = this.items;
		Ext.Array.each(items, function(item){
			if (!item.allowBlank) {
				//item.labelStyle = 'color:blue;';
				item.labelStyle = noAllowBlankFieldLabelStyle;
			}
		});
		
		cceaf.control.FieldSet.superclass.initComponent.call(this);
	}
	
});